/*******************************************************************************

This code file cleans a mapping from 2010 Census tracts to Neighborhood 
Tabulation Areas, a unit created by NYC for use between tract and county.

*******************************************************************************/

*** Manage settings

	run "~/Dropbox (MIT)/Research/NYC421a/code/modules/settings.do"
	
*** Load data

	import excel "$data/raw/nyc2010census_tabulation_equiv.xlsx", sheet("NTA to 2010 CT equivalency") cellrange(A4:G2173) firstrow clear
	
*** Clean data

	renvars, lower
	
	drop if _n==1
	
	keep nycboroughcode censustract g neighborhoodtabulationareant
	
	rename censustract ct2010
	rename g nta_
	rename nycboroughcode borough
	rename neighborhoodtabulationareant nta_code
	
	destring borough ct2010, replace
	
	encode nta_, gen(nta)
	drop nta_
	
*** Save data

	save "$data/clean/ct2010_to_nta.dta", replace
